<?php
/**
 * User: Feng
 * Date: 2024/05/28
 */

namespace app\web\controller;

use app\common\controller\Web;
use app\common\model\Link;
use app\common\model\ScenarioBenefit;
use app\common\model\ScenarioMerit;
use app\common\model\ScenarioPainSpot;
use app\common\model\ScenarioScene;
use app\common\model\ScenarioSparkle;

/**
 * 行业方案
 * User: Feng
 * Date: 2024/05/28
 * @package app\home\controller
 */
class Scenario extends Web
{
	public function scenario()
	{
		$id = $this->request->param('id');
		$scenario = (new \app\common\model\Scenario())->get($id);
		$scenario['pic'] = _sImage($scenario['pic']);
		//痛点
		$scenario_pain_spot = (new ScenarioPainSpot())->where(['scenario_id' => $id])->select();
		//价值
		$scenario_merit = (new ScenarioMerit())->where(['scenario_id' => $id])->select();
		foreach ($scenario_merit as $item){
			$item['merit_pic'] = _sImage($item['merit_pic']);
		}
		//亮点
		$scenario_sparkle = (new ScenarioSparkle())->where(['scenario_id' => $id])->select();
		foreach ($scenario_sparkle as $item){
			$item['pic'] = _sImage($item['pic']);
		}
		//场景
		$scenario_scene = (new ScenarioScene())->where(['scenario_id' => $id])->select();
		foreach ($scenario_scene as $item){
			$item['pic1'] = _sImage($item['pic1']);
			$item['pic2'] = _sImage($item['pic2']);
			$item['pic3'] = _sImage($item['pic3']);
		}
		//优势
		$scenario_benefit = (new ScenarioBenefit())->where(['scenario_id' => $id])->select();
		foreach ($scenario_benefit as $item){
			$item['pic'] = _sImage($item['pic']);
		}
		$this->assign('pain_spot', $scenario_pain_spot);
		$this->assign('merit', $scenario_merit);
		$this->assign('sparkle', $scenario_sparkle);
		$this->assign('scene', $scenario_scene);
		$this->assign('benefit', $scenario_benefit);
		$this->assign('scenario', $scenario);

		$employ = (new Link())->get(['position' => 6]);
		$this->assign('employ', $employ);
		return view('scenario');
	}
}